<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<title>礼品列表</title>
<%@include file="/common/wxCommon.jspf"%>
<style>
.weui_article p {
    margin: 3px 0;
}
.sec {
	padding: 0px 3px;
}

.red{
	color: red;
}
</style>
<body ontouchstart>
	<div class="weui_msg hide">
		<div class="weui_icon_area">
			<i class="weui_icon_info weui_icon_msg"></i>
		</div>
		<div class="weui_text_area">
			<p class="weui_msg_desc">暂无礼品</p>
		</div>
	</div>
	<article class="weui_article">
		<section id="bd">
		</section>
	</article>
	<script type="text/javascript">
		var pageNow = 1;
		var loading = false;
		$(document.body).infinite().on("infinite", function() {
			loadData();
		});

		//加载普通活动
		function loadData() {
			if (loading)
				return;
			loading = true;
			$.getJSON(rootPath + '/weixin/commodity/findByPage.shtml', {'pageNow' : pageNow, 'pageSize' : 5 }, function(result) {
				$.each(result.records, function(i, e) {
					$("#bd").append("<section><p><img src='${ctx}/upload/images/" + e.images + "' alt=''></p>" +
									"<p class='sec'>礼品名称:<label class='gray'>" + e.name + "</label></p>" + 
									"<p class='sec'>礼品属性:<label class='gray'>" + e.property + "</label></p>" + 
									"<p class='sec'>礼品价格:<label class='red'>￥" + e.money + "元</label></p>" + 
									"<p class='sec'>兑换积分:<label class='red'><i class='integ'></i>" + e.integralPrice + "个</label></p>" + 
									"<p class='sec'>礼品详情:<label class='gray'>" + e.description + "</label></p></section>");
				});
				pageNow += 1;
				loading = false;
				if (pageNow > result.pageCount) {
					$(document.body).destroyInfinite();
				}

				if (result.rowCount == 0) {
					$("div.hide").removeClass("hide");
				}
			});
		}
		$(function() {
			loadData();
		});
	</script>
</body>
</html>